package com.springboot.web.entity;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.springboot.web.serializer.RatingDeserializer;
import com.springboot.web.serializer.SpecialFeaturesDeserializer;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Set;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Film {

    @JsonProperty("film_id")
    private Integer filmId;

    private String title;

    private String description;

    @JsonProperty("release_year")
    private String releaseYear;

    @JsonProperty("language_id")
    private Integer languageId;

    @JsonProperty("original_language_id")
    private Integer originalLanguageId;

    @JsonProperty("rental_duration")
    private Integer rentalDuration;

    @JsonProperty("rental_rate")
    private Double rentalRate;

    private Integer length;

    @JsonProperty("replacement_cost")
    private Double replacementCost;

    @JsonDeserialize(using = RatingDeserializer.class) // 指定自定义反序列化器
    private Rating rating;

    @JsonProperty("special_features")
    @JsonDeserialize(using = SpecialFeaturesDeserializer.class)
    private Set<String> specialFeatures;

    @JsonProperty("last_update")
    private java.util.Date lastUpdate;
}
